package ADT;
import static ADT.Values.*;
/**
 *
 * @author Martin
 */
public class ForceInN extends Scalar implements Force{
    private final double newton;
    
    @Override public boolean isValid() {return true;}
    @Override public boolean isZero() {return newton == 0.0;}
    
    public ForceInN(double  newton){
        this.newton =  newton;
    } 
    
    @Override
    public Force inverse(){
        return new ForceInN(this.newton * -1);
    }
    
    @Override public double  n(){return newton;}
    
    @Override public Force add(Force force){return valueOf(this.n() + force.n());}
   
    @Override public Force sub(Force force){return valueOf(this.n() - force.n());}
    
    @Override public Force div(double factor){return valueOf(this.newton / factor);}
    
    @Override public  Force mul(double factor){return valueOf(this.newton * factor);}
    
    @Override public double div(Force force){return this.newton / force.n();}
    
    @Override public Acc div(Mass mass){return accInMss(newton / mass.kg());}
    
    
public String toString(){return String.format("Force: %.2f N", this.newton);}
    
    @Override
    public int compareTo(Force force){
        return Double.compare(this.newton, force.n());
    }
    
    @Override
    public boolean equals(Object o){
        if(this == o) return true;
        if(!(o instanceof ForceInN)) return false;
        return this.compareTo((ForceInN)o) == 0;
    }
    
    
    public static Force valueOf(double msec){
        return new ForceInN(msec);
    }
    
    @Override
    public int hashCode(){
        return hashDouble(newton);
    }
}